package projects.jnurse.ioc.core.reflection;

import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by Adil Naji.
 * User: XP-170708
 * Date: 18 nov. 2008
 * Time: 18:40:58
 */
public class Result<T> {
    private List<T> resultList = new ArrayList<T>();
    public List<T> getResultList() { return resultList; }
    public T getSingleResult() { return resultList.isEmpty() ? null : resultList.get(0); }
    public void addResult(List<T> result) { this.resultList.addAll(result); }
    public void addResult(T result) { this.resultList.add(result); }
    public void addResult(T[] result) { resultList.addAll(Arrays.asList(result)); }
    public void clear() { resultList = new ArrayList<T>(); }
}
